Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fssnip highlighter in API docs code examples. #780

Merged
merged 5 commits into from
Nov 22, 2022
Merged

Conversation

nhirschey
Copy link
Collaborator

This adds syntax highlighting to API docs code examples. PR #762 from @yazeedobaid was solving the same problem, but it relied on external tools such as highlight.js to do the highlighting and required users to add that dependency. This PR uses FSharp.Formatting's baked-in highlighter to achieve the same goal.

For example, building the F# core docs Array.averageBy example using this PR:

image


In comparison, this is how it looks now:

image

@nhirschey
Copy link
Collaborator Author

@yazeedobaid are you happy with this version?

@nhirschey
Copy link
Collaborator Author

Now with the extra trailing blank line after the last line of code removed (adding back a prior dsyme fix). Should be ready for release.

image

@yazeedobaid
Copy link
Contributor

@nhirschey tested the branch with the FAKE website and all is good. But I may add back that padding by a CSS rule for the code examples since it is more visually looking good with some padding:
image

That is FAKE related. Thanks for the update.

@dsyme dsyme merged commit 2cda5a9 into main Nov 22, 2022
@dsyme dsyme deleted the api-highlight branch November 22, 2022 15:39
@dsyme
Copy link
Contributor

dsyme commented Nov 22, 2022

@nhirschey Fantastic work, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants